import React from 'react';
import {
    View,
    TouchableOpacity,
    Text,
    Navigator
} from 'react-native';

import BillList from './BillList.js';
import NavigationBar from './NavigationBar.js'

export default class BillDetaill extends React.Component {

    constructor(props) {
        super(props);
        this.state = {};
    }
    _leftItemAction() {
        const { navigator } = this.props;
        if (navigator) {
            //很熟悉吧，入栈出栈~ 把当前的页面pop掉，这里就返回到了上一个页面:FirstPageComponent了
            navigator.pop();
        }
    }

    _rightItemAction() {
        console.log('右侧按钮点击了');
    }
    _pressButton() {
        const { navigator } = this.props;
        if (navigator) {
            //很熟悉吧，入栈出栈~ 把当前的页面pop掉，这里就返回到了上一个页面:FirstPageComponent了
            navigator.pop();
        }
    }

    render() {
        return (
            <View>
                <NavigationBar
                    title='列表页'
                    leftItemTitle='<返回'
                    rightItemTitle=''
                    rightTextColor='#3393F2'
                    leftItemFunc={this._leftItemAction.bind(this)}
                    rightItemFunc={this._pressButton.bind(this)} />
                <TouchableOpacity onPress={this._pressButton.bind(this)}>
                    <Text>点我跳回去</Text>
                </TouchableOpacity>
            </View>
        );
    }
}